package com.demo.mobile;

import com.mdx.mobile.commons.MException;

public class MobException extends MException{
	private static final long serialVersionUID = 1L;
	
	private IMError error;
	
	public IMError getError() {
		return error;
	}

	public void setError(IMError error) {
		this.error = error;
	}

	public MobException(IMError error) {
		super(error.getErrorCode(),error.getErrorMsg());
		this.error = error;
	}
	
	public MobException(final int code,final String msg) {
		super(code,msg);
		error = new IMError() {
			public String getErrorMsg() {
				return msg;
			}
			
			public int getErrorCode() {
				return code;
			}
		};
	}
	
	public MobException(final String name) {
		super(1006,"缺失必要参数:"+name);
		error = new IMError() {
			public String getErrorMsg() {
				return "缺失必要参数:"+name;
			}
			
			public int getErrorCode() {
				return 1006;
			}
		};
	}
}
